package com.net.lnk.dubbo.user.service.impl;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.net.lnk.dubbo.user.api.UserService;
import com.net.lnk.dubbo.user.api.response.UserDTO;
import com.net.lnk.dubbo.user.service.dao.UserDao;
import com.net.lnk.dubbo.user.service.entity.UserEntity;

@Service(version = "1.0.0")
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;

	@Override
	public UserDTO getById(Long id) {
		UserEntity user = userDao.findOne(id);
		
		UserDTO userDTO = new UserDTO();
		userDTO.setId(user.getId());
		userDTO.setName(user.getName());
		userDTO.setUsername(user.getUsername());
		userDTO.setAge(user.getAge());
		userDTO.setBalance(user.getBalance());
		
		return userDTO;
	}

}
